# -*- coding: utf-8 -*-
"""
@Env 
@Time 2024/9/6 下午5:05
@Author yzpang
@Function: 模型评估服务
"""
import os
from ..entity.request import EvaluateMessage
from modelserver.configs.base_config import get_logger
from modelserver.configs.model_config import MODEL_ROOT_PATH, DATASET_ROOT_PATH


def evaluate_accuracy(eval_info: EvaluateMessage):
    model_path = os.path.join(MODEL_ROOT_PATH, eval_info.modelPath)
    label_path = os.path.join(DATASET_ROOT_PATH, eval_info.labelPath)
    data_path = os.path.join(DATASET_ROOT_PATH, eval_info.dataPath)
    classification_type = eval_info.classificationType

    evaluator = None
    accuracy = evaluator.evaluate(label_path=label_path, data_path=data_path)
    get_logger().info(f"Accuracy: {accuracy}")
    return accuracy
